# -*- coding: utf-8 -*-
from django.db import models

class DayWeather(models.Model):
    """
    天气
    """
    name = models.CharField(u'天气', max_length=100,blank=True,null=True)
    low = models.IntegerField(u'最低气温')
    height = models.IntegerField(u'最高气温')
    wind = models.CharField(u'风级', max_length=100,blank=True,null=True)
    rain = models.CharField(u'降水', max_length=100,blank=True,null=True)
    date = models.DateField(u'日期')
    source = models.CharField(u'来源', max_length=100)
    province = models.CharField(u'省', max_length=20)
    city = models.CharField(u'市', max_length=20)

    class Meta:
        verbose_name=u"天气"
        verbose_name_plural=u"天气管理"

    def __unicode__(self):
        return '%s' % (self.name)

    def date_str(self):
        return self.date.strftime("%Y-%m-%d")
    date_str.short_description = u'日期'

class CityError(models.Model):
    """
    错误省市
    """
    province = models.CharField(u'省', max_length=20)
    city = models.CharField(u'市', max_length=20)
    info = models.CharField(u'错误信息', max_length=200)

    class Meta:
        verbose_name=u"错误省市"
        verbose_name_plural=u"错误省市管理"

    def __unicode__(self):
        return '%s' % (self.city)
